import request from '@/utils/request'

// /sys/role
// 获取已启用角色详情
export const getSysRole = (data) => {
  return request({
    method: 'GET',
    url: '/sys/role',
    params: {
      page: data.page,
      pagesize: data.pageSize
    }
  })
}

// 角色新增  /sys/role
export const postSysRole = (data) => {
  return request({
    method: 'POST',
    url: '/sys/role',
    data
  })
}

// 删除角色 /sys/role/{id}
export const delSysRole = id => {
  return request({
    method: 'DELETE',
    url: `/sys/role/${id}`
  })
}

// 分配权限 /sys/role/assignPrem
// export const putSysRole = () => {
//   return request({
//     method: 'PUT',
//     url: '/sys/role/assignPrem'
//   })
// }

// 修改角色 /sys/role/{id}
export const putSysRole = (id, data) => {
  return request({
    method: 'PUT',
    url: `/sys/role/${id}`,
    data
  })
}

// 获取-角色详情
export const getSysRoleId = id => {
  return request({
    method: 'GET',
    url: `/sys/role/${id}`
  })
}

// 获取-权限点列表 /sys/permission
export const getSysPermission = () => {
  return request({
    method: 'GET',
    url: '/sys/permission'
  })
}

